//app.js
var station = require('api/api.js');
var ses = require('common.js');
var loginApi = require('api/loginApi.js');
var cgs = require('config.js');
var config = cgs.config();
var appid = config.appid;
App({
  commonUrl : config.url,
  imgUrl : config.url+`car_img`,
  nid : config.nid,
  code:'',
  openid:'',
  mid:0,
  userinfo:[],
  onLaunch: function () {
    var that = this;

    //调用API从本地缓存中获取数据
    var logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs);

    
    //station.config(config.url,that,config.nid);
  },
  onError:function(e){

    if(typeof(e.errMsg) == 'undefined'){
        
        if(typeof(e) == 'string'){
          var msg = e;
        }else{
          var msg = '不知道';
        }
    }else{
        var msg = e.errMsg;
    }

    // wx.showToast({
    //     title: '错误~'+msg,
    //     duration: 1000,
    //     icon: 'success'
    // })
    console.log('报错',e);
  },
  clearLogs:function(){
    wx.clearStorage()
    try {
        wx.clearStorageSync()
    } catch(e) {

    }
  }

})